package com.unohacha.qqj.fzdr.personal.view.activity;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.unohacha.qqj.fzdr.R;
import com.unohacha.qqj.fzdr.common.bean.HttpResult;
import com.unohacha.qqj.fzdr.common.http.RetrofitManager;
import com.unohacha.qqj.fzdr.common.utils.TemporaryDataUtil;
import com.unohacha.qqj.mylibrary.base.BaseActivity;

import butterknife.BindView;
import butterknife.OnClick;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class ForgetPasswordActivity extends BaseActivity {

    @BindView(R.id.common_back)
    ImageView commonBack;
    @BindView(R.id.common_title)
    TextView commonTitle;
    @BindView(R.id.common_right_image)
    ImageView commonRightImage;
    @BindView(R.id.common_right_text)
    TextView commonRightText;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_forget_password;
    }


    @OnClick(R.id.tv_send_verification)
    void onVerifycation() {
        Call<HttpResult<String>> call = RetrofitManager.getInstance().getSMSMessage("2", TemporaryDataUtil.getUserInfoBean().getTelephone());
        call.enqueue(new Callback<HttpResult<String>>() {
            @Override
            public void onResponse(Call<HttpResult<String>> call, Response<HttpResult<String>> response) {
                String data = response.body().getData();
                if (data != null) {
                    Toast.makeText(getApplicationContext(), "验证码：" + data, Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(getApplicationContext(), "验证码发送失败", Toast.LENGTH_SHORT).show();
                }
            }

            @Override
            public void onFailure(Call<HttpResult<String>> call, Throwable t) {
                Toast.makeText(getApplicationContext(), "验证码发送失败", Toast.LENGTH_SHORT).show();
            }
        });
    }

    @OnClick(R.id.common_back)
    void onBackClick() {
        finish();
    }



    @Override
    protected void initView() {
//        super.initView();
//        commonTitle.setText("");
        commonTitle.setVisibility(View.INVISIBLE);
        commonRightImage.setVisibility(View.INVISIBLE);

    }
}
